package com.yunhe.dtu.util;

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;

/**
 * @ClassName LogAnalysisUtils
 * @Description TODO
 * @Author HeTao
 * @Date 2020/12/18 12:38
 * @Version 1.0
 **/
public class LogAnalysisUtils{

    public static List<String> useJavaGrok(File file){
        BufferedReader reader = null;
        List<String> list = new ArrayList<>();
        try {
            reader = new BufferedReader(new FileReader(file));
            String tempStr;
            while ((tempStr = reader.readLine()) != null) {
                //System.out.println(tempStr);
                if(tempStr.contains("dtu的整条数据:")){
                    list.add(tempStr);
                    //System.out.println(tempStr);
                }
                //System.out.println(tempStr);
            }
            reader.close();
            return list;
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
            }
        }
        return list;
    }

}
